Skip to content

Improved Procedural Generation#49

Open
TheBardWhoCodes wants to merge 8 commits intoGodotCommunityGamesOrg:mainfrom
TheBardWhoCodes:improved-proc-gen-1
Open

Improved Procedural Generation#49
TheBardWhoCodes wants to merge 8 commits intoGodotCommunityGamesOrg:mainfrom
TheBardWhoCodes:improved-proc-gen-1

Conversation

@TheBardWhoCodes
Copy link
Copy Markdown
Contributor

This pull request introduces significant updates to the procedural generation system, refactors tile sets for terrain and objects, and enhances pathfinding functionality. The most important changes include the addition of a new abstract ProceduralGenerator class, the replacement of terrain tile sets with space station-specific ones, and the integration of pathfinding initialization into the map_generator script.

Procedural Generation Enhancements:

  • scripts/procedural_generator.gd: Added an abstract ProceduralGenerator class with properties for floor, wall, entrance, exit, and player positions, along with methods for generation and clearing. This class provides a foundation for procedural generation logic.

Tile Set Updates:

  • resources/space_station_objects.tres: Introduced a new tile set for space station objects, including player and door scenes, with a tile size of 64x64.
  • resources/test1_terrain_procgen_tileset.tres and resources/test2_terrain_procgen_tileset.tres: Removed outdated terrain tile sets used for procedural generation. [1] [2]

Scene Updates:

  • scenes/room_generator.tscn: Refactored the room generator scene to use the new space station terrain and object tile sets, replacing the old procedural terrain tile set. Updated node properties for floor and object tilesets.
  • scenes/player/world.tscn: Integrated a procedural generator resource into the RoomGenerator node, defining parameters for walker-based room generation.

Pathfinding Integration:

  • scripts/map_generator.gd: Added an init_pathfinding method to initialize the pathfinder (AStarGrid2D) and map references, enhancing the readiness of pathfinding functionality in the game.

Copy link
Copy Markdown
Collaborator

@ChaoticTechSupport ChaoticTechSupport left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, I like the idea of threading, but it might be better to use an async function instead, but I'll leave that up to your discretion.

  • missing some documentation
  • for functions and script variables that will not be used outside the script please add a _ at the start of the name.

@@ -0,0 +1,23 @@
extends Resource
class_name ProceduralGenerator
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs please

class_name ProceduralGenerator

var floor_positions: Array[Vector2i] = []
var wall_positions: Array[Vector2i] = []
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs please

push_error("ProceduralGenerator is abstract and cannot be instantiated directly.")
assert(false)

func generate(rng: RandomNumberGenerator) -> void:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs please

func generate(rng: RandomNumberGenerator) -> void:
assert(false, "generate() must be implemented by a subclass.")

func clear() -> void:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs please

procedural_generator.generate(rng)
apply_terrain_changes()

func clear_the_previous_room() -> void:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs please

@@ -0,0 +1,268 @@
extends ProceduralGenerator
class_name WalkerGenerator
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs pls

extends ProceduralGenerator
class_name WalkerGenerator

@export var number_of_walkers: int = 1
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs pls

var room_height: int
var rng: RandomNumberGenerator

func generate(_rng: RandomNumberGenerator) -> void:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs please

func is_in_bounds(pos: Vector2i) -> bool:
return pos.x >= 0 and pos.x < room_width and pos.y >= 0 and pos.y < room_height

func walker_thread_func(args):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs please

@ChaoticTechSupport
Copy link
Copy Markdown
Collaborator

is this still being worked on?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants